package com.qiu.wxapi.commom;

import java.io.Serializable;

public class ResponseResult implements Serializable {
    private int code;//200是正常，其他为异常
    private String msg;
    private Object data;

    public ResponseResult() {
    }

    public ResponseResult(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ResponseResult success(String msg, Object data){
        return new ResponseResult(200,msg,data);
    }

    public static ResponseResult success(Object data){
        return new ResponseResult(200,"操作成功",data);
    }
    public static ResponseResult fail(String msg,Object data){
        return new ResponseResult(-1,msg,data);
    }
    public static ResponseResult fail(int code,String msg,Object data){
        return new ResponseResult(code,msg,data);
    }

    public static ResponseResult fail(String msg){
        return new ResponseResult(-1,msg,null);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
